<h1>Log Belanja Produk</h1>
<div class="list">
    <table cellpadding="0" cellspacing="0">
        <tr>
            <th width="10">No.</th>
            <th>Kode Transaksi</th>
            <th width="50">Total Item</th>
            <th width="80">Total Harga</th>
            <th width="80">BV</th>
            <th width="180">Tanggal</th>
            <th width="50">Status</th>
        </tr>
        <?php
        if ($data != false) {
            $no = 1;
            $totalitem = $totalharga = $totalbv = 0;
            foreach ($data as $row) {
                $transaction_status = ($row['transaction_is_approve'] == '1') ? 'Diproses' : 'Pending';
                echo '<tr>';
                echo '<td align="right">' . $no . '.</td>';
                echo '<td align="center"><a href="' . Yii::app()->baseUrl . '/member/ecommerce/log/detail/' . $row['transaction_code'] . '">' . $row['transaction_code'] . '</a></td>';
                echo '<td align="right">' . number_format($row['transaction_total_quantity']) . '</td>';
                echo '<td align="right">' . number_format($row['transaction_total_price']) . '</td>';
                echo '<td align="right">' . number_format($row['total_bv']) . '</td>';
                echo '<td align="center">' . function_lib::convert_datetime($row['transaction_datetime'], 'text', '', ':', 'ina') . '</td>';
                echo '<td align="center">' . $transaction_status . '</td>';
                echo '</tr>';

                $no++;
                $totalitem = $totalitem + $row['transaction_total_quantity'];
                $totalharga = $totalharga + $row['transaction_total_price'];
                $totalbv = $totalbv + $row['total_bv'];
            }
            ?>
            <tr>
                <td align="center" colspan="2"><b>T O T A L</b></td>
                <td align="right"><?php echo number_format($totalitem); ?></td>
                <td align="right"><?php echo number_format($totalharga); ?></td>
                <td align="right"><?php echo number_format($totalbv); ?></td>
                <td align="center" colspan="2">-----====-----</td>
            </tr>
            <?php
        } else {
            echo '<tr><td colspan="6" align="center">-----====-----</td></tr>';
        }
        ?>
    </table>
</div>